package com.ruoyi.project.cyq.collection.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.cyq.collection.domain.CollectionVo;
import com.ruoyi.project.cyq.collection.domain.MyCollection;
import com.ruoyi.project.cyq.collection.domain.CollectionVo;
import com.ruoyi.project.cyq.collection.service.MyCollectionService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 刘鹿
 * @date 2020-09-19 17:17
 */
@Controller
@RequestMapping("/cyq/collection")
public class MyCollectionController extends BaseController {

    private String prefix = "cyq/collection";

    @Autowired
    private MyCollectionService myCollectionService;

    //跳转到页面
    @RequiresPermissions("cyq:collection:view")
    @GetMapping()
    public String operlog() {
        return prefix + "/collection";
    }

    //展示数据
    @RequiresPermissions("cyq:collection:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(MyCollection myCollection){
        startPage();
        List<CollectionVo> list = myCollectionService.selectMyCollectionList(myCollection);
        return getDataTable(list);
    }


}
